decorative banner

Using the "hasParent()" attribute


    Use the hasParent() attribute to determine if a layer has a parent. You can use this attribute even if there isn't a parent layer at present. For example, the following expression indicates that the layer to which you apply it will wiggle based on the position of the layer's parent. If the layer has no parent, then it will wiggle based on its own position. If the layer is parented later, then its behavior will change accordingly:

    idx = index;
    if (hasParent) {
        idx = parent.index;
    }
    thisComp.layer(idx).position.wiggle(5, 20)